package ice.hufs.ac.kr.push;

import android.media.*;
import android.os.*;
import android.app.Activity;
import android.content.*;
import android.graphics.drawable.*;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;

public class AcceptedActivity extends Activity {

	SoundPool spAccept;
	int sdAccept;
	Handler acHandler;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_accept);

		spAccept = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
		sdAccept = spAccept.load(this, R.raw.accept, 1);

		int waitLimit = 1000;
		int waitCounter = 0;
		int throttle = 10;

		while(spAccept.play(sdAccept, 1.f, 1.f, 0, 0, 1.f) == 0 && waitCounter < waitLimit){
			waitCounter++; SystemClock.sleep(throttle);
		}

		acHandler = new Handler() {
			public void handleMessage(Message msg) {
				super.handleMessage(msg);

				finish();

			}
		};
		acHandler.sendEmptyMessageDelayed(0, 5000);


	}

	public void onBackPressed() {

	}

	public boolean onKeyDown(int keyCode, KeyEvent event) {  
		if (keyCode == KeyEvent.KEYCODE_MENU) {  
			if (event.isLongPress()) {  
				return true;  
			}  
		}  
		return super.onKeyDown(keyCode, event);  
	}

	public boolean onKeyLongPress(int keyCode, KeyEvent event) {  
		if (keyCode == KeyEvent.KEYCODE_SEARCH) {  
			return true;  
		}  
		return super.onKeyLongPress(keyCode, event);  
	}

}

